<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/laypublic.jsp" %>
<%@ include file="../../include/vueComponent.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>开标结果详情</title>
</head>
<link rel="stylesheet" href="${ctx}/resources/vue-element-lib/detail.css">
<body>
<div id="app">
    <div class="layui-tab layui-tab-brief" lay-filter="xqxx-tab-all">
        <ul class="layui-tab-title">
            <li id="tbglId" class="layui-this" lay-id="0">开标结果详情</li>
            <li id="zgysId" lay-id="1">历史审批信息</li>
        </ul>
        <div class="layui-tab-content" style="height: 100px;">
            <div class="layui-tab-item layui-show">
                <div class="container">
                    <el-form ref="formRef" label-width="140px" label-suffix="："
                             label-position="left">
                        <%--项目基础信息--%>
                        <div class="title">
                            <h3>项目基础信息</h3>
                        </div>
                        <!--表单-->
                        <el-row>
                            <x-col>
                                <el-form-item label="项目名称" label-width="180px">
                                    <span>{{info.proName}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="牵头单位" label-width="180px">
                                    <span>{{info.signupLead}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="联合体成员" label-width="180px">
                                    <span>{{info.signupLeadPer}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="投标部门" label-width="180px">
                                    <span>{{info.deptName}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="营销经理" label-width="180px">
                                    <span>{{info.staffName}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="投标日期" label-width="180px">
                                    <span>{{info.bidDate}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="是否中标" label-width="180px">
                                    <span>{{info.bidding==0?'否':'是'}}</span>
                                </el-form-item>
                            </x-col>

                        </el-row>
                        <div class="title">
                            <h3>开标记录及排名</h3>
                        </div>
                        <div class="unit">
                            <div class="unit_center">
                                <el-table :data="bidOpenRecords" style="width: 100%" border>
                                    <el-table-column type="index" width="50" align="center"
                                                     label="排名"></el-table-column>
                                    <el-table-column prop="unit" label="名称" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.bidName" disabled></el-input>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="报价" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.bidPriceMemo" type="number"
                                                      disabled></el-input>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <div class="title">
                            <h3>中标单位报价</h3>
                        </div>
                        <div class="unit">
                            <div class="unit_center">
                                <el-table :data="afterSummBidList" style="width: 100%" border>
                                    <el-table-column prop="unit" label="名称" align="center">
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.bidName" style="width: 100%" filterable
                                                       disabled
                                                       placeholder="请选择">
                                                <el-option v-for="item in personnel" :key="item.id"
                                                           :label="item.coopName" :value="item.id"></el-option>
                                            </el-select>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="中标单位报价" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.bidPriceMemo" type="number" min="0"
                                                      disabled></el-input>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="我司报价" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.bidMyPriceMemo" type="number" disabled
                                                      min="0"></el-input>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <%--项目附件信息--%>
                        <div class="title">
                            <h3>项目附件信息</h3>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:350px;">支持pdf、excel、word、图片资料，可上传多个</label>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">中标公示截图</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <div class="layui-upload-list" id="27-upload-more-list">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-form>
                </div>
            </div>
            <div class="layui-tab-item">
                <%@ include file="lay-processHistory-detail.jsp" %>
            </div>
        </div>
    </div>
</div>
<script src="${ctx}/resources/vue-element-lib/jquery.js"></script>
<script>
    var fileArr = [];
    var staticPath = '${fileHttpPre}';
    layui.config({
        base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set', 'upload', 'table', 'transfer', 'laydate', 'element', 'layer'], function () {
        var $ = layui.$
            , upload = layui.upload
            , table = layui.table
            , element = layui.element
            , layer = layui.layer;
    });

    //删除文件
    function del(index) {
        layui.$("#fileAtt_" + index).remove();
        layui.$("#upload_img_" + index).remove();
        fileArr.map((el, idx) => {
            if (el.split('|')[2] == index) {
                fileArr.splice(idx, 1)
            }
        })
    }

    //根据url查看文件
    function showImg(url) {
        var openWin = window.open(url, '', 'left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
    }

    /*核心*/
    var vm = new Vue({
        el: '#app',
        data() {
            return {
                layId: '0',
                procNodeList: [],
                tempNodeList: [],
                auditMsg: '',//审批意见

                info: {},
                id: '',
                processId: '',
                bidOpenRecords: [],//开标记录及排名
                afterSummBidList: [],//中标单位报价
                personnel: [],
            }
        },
        created() {
            let that = this;
            that.id = "${id}";
            that.processId = "${processId}";
            that.queryCoopInfo();
            that.queryProcessList();
        },
        mounted() {

        },
        methods: {
            queryProcessList() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/historyProcess/proNodeDetail',  //请求数据接口
                    data: {processId: that.processId},
                    success: function (result) {
                        if (result.entity) {
                            that.procNodeList = result.entity.procNodeList;
                            that.tempNodeList = result.entity.tempNodeList;
                            that.info = result.entity.detailJson.info;
                            that.yesOrNo = result.entity.detailJson.yesOrNo;
                            that.bidBondMode = result.entity.detailJson.bidBondMode;
                            that.bidOpenRecords = result.entity.detailJson.bidOpenRecords;
                            that.afterSummBidList = result.entity.detailJson.afterSummBidList;


                            if (fileArr.length == 0) {
                                that.showFile(result.entity.detailJson.fileAtt);
                            }
                        }
                    }
                });
            },
            queryCoopInfo() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/proSell/queryCoopInfo',  //请求数据接口
                    data: {},
                    success: function (result) {
                        that.personnel = result
                    }
                });
            },
            // proSell/queryCoopInfo
            showFile(fileList) {
                if (fileList && fileList.length > 0) {
                    fileArr = fileList;
                    for (let i in fileList) {
                        let contractInfo = fileList[i];
                        let arr = contractInfo.split("|");
                        let imgSrc = "";
                        let suffix = arr[1].substring(arr[1].lastIndexOf(".") + 1, arr[1].length);
                        if (suffix == 'jpg' || suffix == 'png') {
                            imgSrc = "${fileHttpPre}/" + arr[3];
                        } else {
                            imgSrc = "${ctx}/resources/images/" + suffix + ".jpg";
                        }
                        $('#' + arr[0] + '-upload-more-list')
                            .append('<div class="layui-upload-img-div" id="upload_img_' + arr[2] + '"><img src="' + imgSrc + '" title="'
                                + arr[1] + '" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\'' + "${fileHttpPre}"
                                + arr[3] + '\');">查看</a><a href="javascript:void(0)" onclick="del(\''
                                + arr[2] + '\')";>删除</a></div><p>' + arr[1] + '</p><input type="hidden" value="'
                                + contractInfo + '" id="fileAtt_' + arr[2] + '" name="fileAtts" ></input></div> ');
                    }
                }
            },

        }
    })
</script>
</body>
</html>

